﻿package mortal.game.view.skill
{
    import Message.DB.Tables.*;
    import Message.Public.*;
    import com.gengine.global.*;
    import flash.utils.*;
    import mortal.common.*;
    import mortal.common.net.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.skill.panel.data.*;
    import mortal.game.view.systemSetting.*;
    import mortal.mvc.core.*;

    public class SkillCache extends Object
    {
        private var _skillLearned:Array;
        private var _careerSkills:Array;
        private var _equipSkills:Array;
        private var _BasicSkills:Array;
        private var _runeDic:Dictionary;
        private var _exSkillList:Array;
        public var isShowingExSkill:Boolean;
        public var backToComboIndex0Time:int;
        public var nextComboSkillIndex:int;
        private var _waittingForServerDic:Dictionary;
        public var lastCollectFinishTime:int;
        private var _waittingServerCollectID:String = "";
        private var _lastIconRedPointTime:Number = -1;
        private var _lastModuleRedPointTime:Number = -1;
        private var _isLastUseRolling:Boolean = false;
        private var _needDisableUseSkill:Boolean;
        private var _useRollingSetTime:int = -1;
        public static const Skill_IconRedPointTime:String = "Skill_IconRedPointTime";
        public static const Skill_ModuleRedPointTime:String = "Skill_ModuleRedPointTime";
        public static const RedPointRefreshTime:int = 2880000;

        public function SkillCache()
        {
            this._skillLearned = [];
            this._BasicSkills = [];
            this._runeDic = new Dictionary();
            this._exSkillList = [];
            this._waittingForServerDic = new Dictionary();
            return;
        }// end function

        public function get isLastUseRolling() : Boolean
        {
            if (this._isLastUseRolling)
            {
                if (getTimer() - this._useRollingSetTime > 4000)
                {
                    return false;
                }
                return true;
            }
            return false;
        }// end function

        public function set isLastUseRolling(param1:Boolean) : void
        {
            this._isLastUseRolling = param1;
            if (this._isLastUseRolling)
            {
                this._useRollingSetTime = getTimer();
            }
            return;
        }// end function

        public function get lastModuleRedPointTime() : Number
        {
            return this._lastModuleRedPointTime;
        }// end function

        public function set lastModuleRedPointTime(param1:Number) : void
        {
            this._lastModuleRedPointTime = param1;
            PulseSharedObject.saveValue(Skill_ModuleRedPointTime, param1);
            var _loc_2:* = (RedPointRefreshTime - ClockManager.instance.nowDate.time + param1) / 1000;
            if (_loc_2 > 0)
            {
                CallLater.setCallLater(this.refreshModuleRedPoint, _loc_2 + 0.1);
            }
            return;
        }// end function

        private function refreshModuleRedPoint(param1 = null) : void
        {
            GameController.skill.refreshModuleRedPoint();
            return;
        }// end function

        public function get lastIconRedPointTime() : Number
        {
            return this._lastIconRedPointTime;
        }// end function

        public function set lastIconRedPointTime(param1:Number) : void
        {
            this._lastIconRedPointTime = param1;
            PulseSharedObject.saveValue(Skill_IconRedPointTime, param1);
            var _loc_2:* = (RedPointRefreshTime - ClockManager.instance.nowDate.time + param1) / 1000;
            if (_loc_2 > 0)
            {
                CallLater.setCallLater(this.refreshIconRedPoint, _loc_2 + 0.1);
            }
            return;
        }// end function

        private function refreshIconRedPoint(param1 = null) : void
        {
            GameController.skill.refreshIconRedPoint();
            return;
        }// end function

        public function get waittingServerCollectID() : String
        {
            if (getTimer() - this.lastCollectFinishTime >= 600)
            {
                this._waittingServerCollectID = "";
            }
            return this._waittingServerCollectID;
        }// end function

        public function set waittingServerCollectID(param1:String) : void
        {
            this._waittingServerCollectID = param1;
            return;
        }// end function

        public function isWaittingForServer(param1:int) : Boolean
        {
            if (this._waittingForServerDic[param1] == null)
            {
                return false;
            }
            var _loc_2:* = this._waittingForServerDic[param1];
            var _loc_3:* = this.getSkill(param1);
            var _loc_4:* = getTimer();
            if (_loc_3 != null)
            {
                if (_loc_4 - _loc_2 < _loc_3.cooldownTime)
                {
                    if (_loc_4 - _loc_2 >= 2000)
                    {
                        GameController.cd.skillUseSucessHandler(new DataEvent("", param1));
                    }
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else if (_loc_4 - _loc_2 >= 2000)
            {
                return false;
            }
            return true;
        }// end function

        public function setWaittingForServer(param1:int, param2:Boolean = true) : void
        {
            if (param2)
            {
                this._waittingForServerDic[param1] = getTimer();
            }
            else if (this._waittingForServerDic.hasOwnProperty(param1))
            {
                delete this._waittingForServerDic[param1];
            }
            return;
        }// end function

        public function set needDisableUseSkill(param1:Boolean) : void
        {
            this._needDisableUseSkill = param1;
            return;
        }// end function

        public function get needDisableUseSkill() : Boolean
        {
            return this._needDisableUseSkill;
        }// end function

        public function initExSkillList(param1:Array) : void
        {
            var _loc_3:SSkill = null;
            this._exSkillList = [];
            var _loc_2:int = 0;
            while (_loc_2 < param1.length)
            {
                
                _loc_3 = param1[_loc_2] as SSkill;
                this.addExSkill(_loc_3);
                _loc_2++;
            }
            return;
        }// end function

        public function getExtSkillBySkillId(param1:int) : SkillInfo
        {
            var _loc_2:SkillInfo = null;
            if (this._exSkillList == null)
            {
                return null;
            }
            for each (_loc_2 in this._exSkillList)
            {
                
                if (_loc_2.skillId == param1)
                {
                    return _loc_2;
                }
            }
            return null;
        }// end function

        public function getExSkillList() : Array
        {
            return this._exSkillList;
        }// end function

        public function addExSkill(param1:SSkill) : void
        {
            var _loc_2:* = new SkillInfo();
            var _loc_3:* = param1.skillId;
            var _loc_4:* = SkillConfig.instance.getInfoById(_loc_3);
            _loc_2.tSkill = _loc_4;
            _loc_2.cdDt = param1.cdDt;
            _loc_2.learned = true;
            this._exSkillList[_loc_4.posType] = _loc_2;
            return;
        }// end function

        public function delExSkill(param1:int) : void
        {
            if (this._exSkillList == null)
            {
                return;
            }
            delete this._exSkillList[param1];
            return;
        }// end function

        public function initRuneList(param1:Array) : void
        {
            var _loc_3:int = 0;
            this._runeDic = new Dictionary();
            var _loc_2:int = 0;
            while (_loc_2 < param1.length)
            {
                
                _loc_3 = param1[_loc_2];
                this.addRune(_loc_3);
                _loc_2++;
            }
            return;
        }// end function

        public function initSkillList(param1:Array) : void
        {
            var _loc_3:SSkill = null;
            this._skillLearned = [];
            var _loc_2:int = 0;
            while (_loc_2 < param1.length)
            {
                
                _loc_3 = param1[_loc_2] as SSkill;
                this.addPlayerSkill(_loc_3);
                _loc_2++;
            }
            return;
        }// end function

        public function removeRune(param1:int) : void
        {
            this.updateRuneToSkill(param1, false);
            return;
        }// end function

        public function addRune(param1:int, param2:int = -1) : void
        {
            this.updateRuneToSkill(param1, true, param2);
            return;
        }// end function

        public function clearAllRuneEffect() : void
        {
            var _loc_1:SkillInfo = null;
            if (this._skillLearned == null)
            {
                return;
            }
            for each (_loc_1 in this._skillLearned)
            {
                
                _loc_1.runeAddCD = 0;
                _loc_1.runeLeadCount = 0;
            }
            return;
        }// end function

        public function updateRuneToSkill(param1:int, param2:Boolean, param3:int = -1) : void
        {
            var _loc_4:* = SkillConfig.instance.getRune(param1);
            if (_loc_4 == null)
            {
                return;
            }
            var _loc_5:* = this.getSkillBySerialId(_loc_4.skillBelong);
            if (_loc_5 == null)
            {
                return;
            }
            if (param3 == -1)
            {
                param3 = parseInt(_loc_4.effectValue);
            }
            switch(_loc_4.effectField)
            {
                case ERuneEffectType._ERuneEffectSkillLeadSkillCount:
                {
                    if (param2)
                    {
                        _loc_5.runeLeadCount = param3;
                    }
                    else
                    {
                        _loc_5.runeLeadCount = 0;
                    }
                    break;
                }
                case ERuneEffectType._ERuneEffectSkillCooldownTime:
                {
                    if (param2)
                    {
                        _loc_5.runeAddCD = param3;
                    }
                    else
                    {
                        _loc_5.runeAddCD = 0;
                    }
                    break;
                }
                case ERuneEffectType._ERuneEffectSkillLeadSkillCount:
                {
                    if (param2)
                    {
                        _loc_5.runeLeadCount = param3;
                    }
                    else
                    {
                        _loc_5.runeLeadCount = 0;
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function runeUpgrade(param1:int) : void
        {
            var _loc_3:* = undefined;
            var _loc_4:TRune = null;
            var _loc_2:* = SkillConfig.instance.getRune(param1);
            for (_loc_3 in this._runeDic)
            {
                
                _loc_4 = this._runeDic[_loc_3];
                if (_loc_4 == null)
                {
                    continue;
                }
                if (_loc_4.skillBelong == _loc_2.skillBelong)
                {
                    if (_loc_4.runePos == _loc_2.runePos)
                    {
                        this.removeRune(int(_loc_3));
                        break;
                    }
                }
            }
            if (_loc_2 != null)
            {
                this.addRune(param1);
            }
            return;
        }// end function

        public function getRuneLearnedBySkillAndPos(param1:int, param2:int) : TRune
        {
            var _loc_3:TRune = null;
            for each (_loc_3 in this._runeDic)
            {
                
                if (_loc_3 == null)
                {
                    continue;
                }
                if (_loc_3.skillBelong == param1)
                {
                    if (_loc_3.runePos == param2)
                    {
                        return _loc_3;
                    }
                }
            }
            return null;
        }// end function

        public function getMyRune(param1:int) : TRune
        {
            return this._runeDic[param1];
        }// end function

        public function getRunesBySerial(param1:int) : Array
        {
            var _loc_6:TRune = null;
            var _loc_7:TSkill = null;
            var _loc_8:RuneItemData = null;
            var _loc_9:TRune = null;
            var _loc_2:Array = [];
            var _loc_3:* = this.getSkillBySerialId(param1);
            if (_loc_3 == null)
            {
                _loc_7 = SkillConfig.instance.getFirstSkillBySerialId(param1);
                _loc_3 = new SkillInfo();
                _loc_3.tSkill = _loc_7;
            }
            var _loc_4:* = Cache.instance.skill.isDebugLearn;
            var _loc_5:* = SkillConfig.instance.getRunesBySerial(param1, 1);
            for each (_loc_6 in _loc_5)
            {
                
                if (_loc_3.isRuneBelongsToMe(_loc_6))
                {
                    _loc_8 = new RuneItemData();
                    _loc_9 = this.getRuneLearnedBySkillAndPos(_loc_6.skillBelong, _loc_6.runePos);
                    if (_loc_9 != null)
                    {
                        _loc_8.info = _loc_9;
                        _loc_8.actived = true;
                        _loc_8.canUpgrade = this.isRuneCanUpgrade(_loc_9, _loc_3, true);
                    }
                    else
                    {
                        _loc_8.info = _loc_6;
                        _loc_8.actived = false;
                        _loc_8.canUpgrade = this.isRuneCanUpgrade(_loc_6, _loc_3);
                    }
                    _loc_2[(_loc_6.runePos - 1)] = _loc_8;
                }
            }
            return _loc_2;
        }// end function

        public function isRuneCanUpgrade2(param1:TRune, param2:SkillInfo, param3:Boolean = false) : Boolean
        {
            if (param2 == null)
            {
                return false;
            }
            if (!param2.learned)
            {
                return false;
            }
            if (param2.skillLevel < param1.skillBelongLevel)
            {
                return false;
            }
            var _loc_4:* = Cache.instance.skill.getRuneLearnedBySkillAndPos(param1.skillBelong, param1.runePos);
            if (_loc_4 == null && param1.level == 1)
            {
                return true;
            }
            if (_loc_4 && param1.level - _loc_4.level == 1)
            {
                return true;
            }
            return false;
        }// end function

        private function isRuneCanUpgrade(param1:TRune, param2:SkillInfo, param3:Boolean = false) : Boolean
        {
            if (param2 == null)
            {
                return false;
            }
            if (!param2.learned)
            {
                return false;
            }
            var _loc_4:* = SkillConfig.instance.getNextLevelRune(param1.runeId);
            if (_loc_4 == null && param3)
            {
                return false;
            }
            var _loc_5:* = Cache.instance.skill.isDebugLearn;
            if (_loc_5)
            {
                return true;
            }
            if (param3)
            {
            }
            else
            {
                _loc_4 = param1;
            }
            if (param2.skillLevel < _loc_4.skillBelongLevel)
            {
                return false;
            }
            if (_loc_4.exp > Cache.instance.role.roleInfo.experience)
            {
                return false;
            }
            if (_loc_4.coin > Cache.instance.role.money.coin + Cache.instance.role.money.coinBind)
            {
                return false;
            }
            if (_loc_4.runicPower > Cache.instance.role.money.runicPower)
            {
                return false;
            }
            if (_loc_4.item > 0)
            {
                if (Cache.instance.pack.backPackCache.getItemCountByItemCode(_loc_4.item) <= 0)
                {
                    return false;
                }
            }
            return true;
        }// end function

        public function getSkillBySerialId(param1:int) : SkillInfo
        {
            var _loc_2:SkillInfo = null;
            for each (_loc_2 in this._skillLearned)
            {
                
                if (_loc_2.tSkill.series == param1)
                {
                    return _loc_2;
                }
            }
            for each (_loc_2 in this._exSkillList)
            {
                
                if (_loc_2.tSkill.series == param1)
                {
                    return _loc_2;
                }
            }
            return null;
        }// end function

        public function getAllCareerSkills(param1:int = 2147483647) : Array
        {
            var _loc_3:Array = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:SkillInfo = null;
            var _loc_7:int = 0;
            if (this._careerSkills == null)
            {
                this._careerSkills = [];
                _loc_3 = SkillConfig.instance.getPlayerSkillSerials(Cache.instance.role.entityInfo.career);
                _loc_4 = 0;
                while (_loc_4 < _loc_3.length)
                {
                    
                    _loc_5 = _loc_3[_loc_4];
                    _loc_6 = this.getSkillBySerialId(_loc_5);
                    if (_loc_6 == null)
                    {
                        _loc_6 = new SkillInfo();
                        _loc_6.tSkill = SkillConfig.instance.getFirstSkillBySerialId(_loc_5);
                    }
                    _loc_7 = _loc_6.tSkill.posType;
                    if (_loc_7 > 0 && _loc_7 <= 20)
                    {
                        this._careerSkills[(_loc_6.position - 1)] = _loc_6;
                    }
                    _loc_4++;
                }
            }
            if (param1 >= 1000)
            {
                return this._careerSkills;
            }
            var _loc_2:Array = [];
            for each (_loc_6 in this._careerSkills)
            {
                
                if (_loc_6 == null)
                {
                    continue;
                }
                if (_loc_6.tSkill.levelLimit <= param1)
                {
                    _loc_2.push(_loc_6);
                }
            }
            return _loc_2;
        }// end function

        public function isLeardEquipSkillById(param1:int) : Boolean
        {
            var _loc_2:Boolean = false;
            var _loc_4:SkillInfo = null;
            var _loc_3:* = this.getAllEquipSkills();
            for each (_loc_4 in _loc_3)
            {
                
                if (_loc_4.learned && _loc_4.skillId == param1)
                {
                    _loc_2 = true;
                    break;
                }
            }
            return _loc_2;
        }// end function

        public function getAllEquipSkills(param1:int = 2147483647) : Array
        {
            var _loc_3:Array = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:SkillInfo = null;
            var _loc_7:int = 0;
            if (this._equipSkills == null)
            {
                this._equipSkills = [];
                _loc_3 = SkillConfig.instance.getPlayerSkillSerials(Cache.instance.role.entityInfo.career);
                _loc_4 = 0;
                while (_loc_4 < _loc_3.length)
                {
                    
                    _loc_5 = _loc_3[_loc_4];
                    _loc_6 = this.getSkillBySerialId(_loc_5);
                    if (_loc_6 == null)
                    {
                        _loc_6 = new SkillInfo();
                        _loc_6.tSkill = SkillConfig.instance.getFirstSkillBySerialId(_loc_5);
                    }
                    _loc_7 = _loc_6.tSkill.posType;
                    if (_loc_7 >= 200 && _loc_7 <= 299)
                    {
                        this._equipSkills[(_loc_6.position - 1)] = _loc_6;
                    }
                    _loc_4++;
                }
            }
            if (param1 >= 1000)
            {
                return this._equipSkills;
            }
            var _loc_2:Array = [];
            _loc_4 = 0;
            while (_loc_4 < this._equipSkills.length)
            {
                
                _loc_6 = this._equipSkills[_loc_4];
                if (_loc_6 != null && _loc_6.tSkill.levelLimit <= param1)
                {
                    _loc_2.push(_loc_6);
                }
                _loc_4++;
            }
            return _loc_2;
        }// end function

        public function getLearnableOrUpgradableCount() : int
        {
            var _loc_2:SkillInfo = null;
            var _loc_1:int = 0;
            if (this.getAllCareerSkills() == null)
            {
                return _loc_1;
            }
            for each (_loc_2 in this._careerSkills)
            {
                
                if (_loc_2.learnable() || _loc_2.upgradable())
                {
                    _loc_1++;
                }
            }
            for each (_loc_2 in this._equipSkills)
            {
                
                if (_loc_2.learnable() || _loc_2.upgradable())
                {
                    _loc_1++;
                }
            }
            return _loc_1;
        }// end function

        public function initAllBasicSkills() : void
        {
            this._BasicSkills = [];
            var _loc_1:* = new SkillInfo();
            _loc_1.tSkill = SkillConfig.instance.getInfoById(GameConst.SkillMount);
            if (GameController.autoGuide.hasGuideMount())
            {
                _loc_1.learned = true;
            }
            this.addBasicSkill(_loc_1);
            this._skillLearned[_loc_1.skillId] = _loc_1;
            _loc_1 = new SkillInfo();
            _loc_1.tSkill = SkillConfig.instance.getInfoById(GameConst.SkillThing);
            if (Cache.instance.role.roleInfo.level >= GameDefConfig.instance.getSystemOpenLevel(27))
            {
                _loc_1.learned = true;
            }
            this.addBasicSkill(_loc_1);
            this._skillLearned[_loc_1.skillId] = _loc_1;
            this.checkAndAddBasicSkills();
            return;
        }// end function

        public function addBasicSkill(param1:SkillInfo) : void
        {
            var _loc_3:SkillInfo = null;
            if (param1 == null)
            {
                return;
            }
            if (this._BasicSkills == null)
            {
                this._BasicSkills = [];
            }
            var _loc_2:int = 0;
            while (_loc_2 < this._BasicSkills.length)
            {
                
                _loc_3 = this._BasicSkills[_loc_2];
                if (_loc_3 != null && _loc_3.tSkill.skillId == param1.tSkill.skillId)
                {
                    this._BasicSkills[_loc_2] = param1;
                    return;
                }
                _loc_2++;
            }
            this._BasicSkills.push(param1);
            return;
        }// end function

        public function checkAndAddBasicSkills() : void
        {
            var _loc_1:Boolean = false;
            var _loc_2:* = this._skillLearned[GameConst.SkillMount] as SkillInfo;
            if (_loc_2 != null && !_loc_2.learned && GameController.autoGuide.hasGuideMount())
            {
                _loc_2.learned = true;
                _loc_1 = true;
            }
            this.addBasicSkill(_loc_2);
            _loc_2 = this._skillLearned[GameConst.SkillThing] as SkillInfo;
            if (_loc_2 != null && !_loc_2.learned && Cache.instance.role.roleInfo.level >= GameDefConfig.instance.getSystemOpenLevel(27))
            {
                _loc_2.learned = true;
                _loc_1 = true;
            }
            this.addBasicSkill(_loc_2);
            _loc_1 = this.checkAndAdXPSkill() || _loc_1;
            _loc_1 = this.checkAndAddRolling() || _loc_1;
            _loc_1 = this.checkAndAddJP() || _loc_1;
            if (_loc_1)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.SkillBasicSkillAdd));
            }
            return;
        }// end function

        public function updateToNewXPSkill() : void
        {
            var _loc_2:SkillInfo = null;
            if (this._BasicSkills == null)
            {
                return;
            }
            var _loc_1:int = 0;
            while (_loc_1 < this._BasicSkills.length)
            {
                
                _loc_2 = this._BasicSkills[_loc_1];
                if (_loc_2 == null)
                {
                }
                else if (_loc_2.tSkill.triggerType == ESkillTriggType._ESkillTriggXp)
                {
                    if (this._skillLearned != null && this._skillLearned[_loc_2.skillId] != null)
                    {
                        delete this._skillLearned[_loc_2.skillId];
                    }
                    _loc_2 = new SkillInfo();
                    _loc_2.tSkill = SkillConfig.instance.getInfoById(Cache.instance.wizard.XpSkillId);
                    _loc_2.learned = true;
                    this._skillLearned[_loc_2.skillId] = _loc_2;
                    this._BasicSkills[_loc_1] = _loc_2;
                    return;
                }
                _loc_1++;
            }
            return;
        }// end function

        private function checkAndAdXPSkill() : Boolean
        {
            var _loc_1:* = Cache.instance.wizard.XpSkillId;
            var _loc_2:* = this._skillLearned[_loc_1];
            if (_loc_1 > 0 && _loc_2 == null)
            {
                _loc_2 = new SkillInfo();
                _loc_2.tSkill = SkillConfig.instance.getInfoById(Cache.instance.wizard.XpSkillId);
                _loc_2.learned = true;
                this.addBasicSkill(_loc_2);
                this._skillLearned[_loc_2.skillId] = _loc_2;
                return true;
            }
            if (_loc_2 != null)
            {
                this.addBasicSkill(_loc_2);
            }
            return false;
        }// end function

        public function checkAndAddRolling() : Boolean
        {
            var _loc_1:SkillInfo = null;
            if (this._skillLearned[GameConst.RollingSkillId] != null)
            {
                this.addBasicSkill(this._skillLearned[GameConst.RollingSkillId] as SkillInfo);
                return false;
            }
            if (GameController.autoGuide.hasGuideRolling())
            {
                _loc_1 = new SkillInfo();
                _loc_1.tSkill = SkillConfig.instance.getInfoById(GameConst.RollingSkillId);
                _loc_1.learned = true;
                this.addBasicSkill(_loc_1);
                this._skillLearned[_loc_1.skillId] = _loc_1;
                return true;
            }
            return false;
        }// end function

        public function checkAndAddJP() : Boolean
        {
            var _loc_1:SkillInfo = null;
            if (this._skillLearned[GameConst.JPSkillId] != null)
            {
                this.addBasicSkill(this._skillLearned[GameConst.JPSkillId] as SkillInfo);
                return false;
            }
            if (GameController.autoGuide.hasGuideJP())
            {
                _loc_1 = new SkillInfo();
                _loc_1.tSkill = SkillConfig.instance.getInfoById(GameConst.JPSkillId);
                _loc_1.learned = true;
                this.addBasicSkill(_loc_1);
                this._skillLearned[_loc_1.skillId] = _loc_1;
                return true;
            }
            return false;
        }// end function

        public function getAllBasicSkills() : Array
        {
            if (this._BasicSkills == null)
            {
                this.initAllBasicSkills();
            }
            return this._BasicSkills;
        }// end function

        public function getAllSkillsLearned() : Array
        {
            return this._skillLearned;
        }// end function

        public function getLearnedCarrerSkills(param1:int = -1) : Array
        {
            var _loc_4:SkillInfo = null;
            var _loc_5:int = 0;
            var _loc_6:TSkill = null;
            var _loc_2:Array = [];
            var _loc_3:* = this.getAllCareerSkills();
            if (_loc_3 == null)
            {
                return _loc_2;
            }
            for each (_loc_4 in _loc_3)
            {
                
                if (_loc_4 == null)
                {
                    continue;
                }
                if (_loc_4.learned)
                {
                    if (param1 <= 0 || param1 == Cache.instance.role.roleEntityInfo.entityInfo.career)
                    {
                        _loc_2.push(_loc_4);
                        continue;
                    }
                    _loc_5 = _loc_4.tSkill.skillLevel;
                    _loc_6 = SkillConfig.instance.getSkillByPosAndCareer(_loc_4.position, param1);
                    if (_loc_6 != null)
                    {
                        _loc_4 = new SkillInfo();
                        _loc_4.learned = true;
                        _loc_4.tSkill = SkillConfig.instance.getSkillByLevel(_loc_6.series, _loc_5);
                        _loc_2.push(_loc_4);
                    }
                }
            }
            return _loc_2;
        }// end function

        public function getSkillCanLearnByPlayerLevel() : Array
        {
            var _loc_4:SkillInfo = null;
            var _loc_1:Array = [];
            var _loc_2:* = this.getAllCareerSkills();
            if (_loc_2 == null)
            {
                return _loc_1;
            }
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                if (_loc_4.learned)
                {
                }
                else if (_loc_4.isLevelEnough(_loc_4.tSkill))
                {
                    _loc_1.push(_loc_4);
                }
                _loc_3++;
            }
            return _loc_1;
        }// end function

        public function getFirstSkill() : SkillInfo
        {
            var _loc_1:SkillInfo = null;
            for each (_loc_1 in this._skillLearned)
            {
                
                if (_loc_1.isComboSkill)
                {
                    return _loc_1;
                }
            }
            return null;
        }// end function

        public function getSkill(param1:int) : SkillInfo
        {
            return this._skillLearned[param1] as SkillInfo;
        }// end function

        public function getExtSkillByPosType(param1:int) : SkillInfo
        {
            if (this._exSkillList == null)
            {
                return null;
            }
            return this._exSkillList[param1];
        }// end function

        public function getSkillByPosType(param1:int, param2:Boolean = true) : SkillInfo
        {
            var _loc_4:SkillInfo = null;
            var _loc_3:* = this._skillLearned;
            if (!param2)
            {
                _loc_3 = this.getAllCareerSkills();
            }
            for each (_loc_4 in _loc_3)
            {
                
                if (_loc_4.position == param1)
                {
                    return _loc_4;
                }
            }
            return null;
        }// end function

        public function addPlayerSkill(param1:SSkill) : void
        {
            var _loc_2:* = new SkillInfo();
            var _loc_3:* = param1.skillId;
            var _loc_4:* = SkillConfig.instance.getInfoById(_loc_3);
            _loc_2.tSkill = _loc_4;
            _loc_2.cdDt = param1.cdDt;
            _loc_2.learned = true;
            this._skillLearned[_loc_3] = _loc_2;
            if (_loc_2.isCareerSkill)
            {
                if (this._careerSkills == null)
                {
                    this.getAllCareerSkills();
                }
                this._careerSkills[(_loc_2.position - 1)] = _loc_2;
            }
            else if (_loc_2.isEquipSkill)
            {
                if (this._equipSkills == null)
                {
                    this.getAllEquipSkills();
                }
                this._equipSkills[(_loc_2.position - 1)] = _loc_2;
            }
            return;
        }// end function

        public function delPlayerSkill(param1:int) : void
        {
            var _loc_2:* = this._skillLearned[param1];
            delete this._skillLearned[param1];
            if (_loc_2.isCareerSkill)
            {
                delete this._careerSkills[(_loc_2.position - 1)];
            }
            if (_loc_2.isEquipSkill)
            {
                delete this._equipSkills[(_loc_2.position - 1)];
            }
            return;
        }// end function

        public function updatePlayerSkill(param1:SSkill) : void
        {
            var _loc_2:* = this._skillLearned[param1.skillId];
            if (_loc_2)
            {
                _loc_2.cdDt = param1.cdDt;
            }
            return;
        }// end function

        public function upgradePlayerSkill(param1:SSkill) : void
        {
            var _loc_3:SkillInfo = null;
            if (this._skillLearned == null)
            {
                return;
            }
            this.getAllCareerSkills();
            var _loc_2:* = SkillConfig.instance.getInfoById(param1.skillId);
            for each (_loc_3 in this._skillLearned)
            {
                
                if (SkillUtil.isNextSkillByTskill(_loc_2, _loc_3.tSkill))
                {
                    this.delPlayerSkill(_loc_3.skillId);
                    break;
                }
            }
            this.addPlayerSkill(param1);
            return;
        }// end function

        public function getComboSkill() : SkillInfo
        {
            var _loc_1:SkillInfo = null;
            for each (_loc_1 in this._skillLearned)
            {
                
                if (_loc_1.isComboSkill)
                {
                    return _loc_1;
                }
            }
            return null;
        }// end function

        public function getNextCanComboSkill() : TSkill
        {
            var _loc_1:* = getTimer();
            if (_loc_1 > this.backToComboIndex0Time)
            {
                this.nextComboSkillIndex = 0;
            }
            var _loc_2:* = this.getComboSkill();
            if (_loc_2 == null)
            {
                return null;
            }
            return SkillUtil.getComboSkillByIndex(_loc_2.tSkill, this.nextComboSkillIndex);
        }// end function

        public function reinitSkillsByCareerChanged() : void
        {
            this._careerSkills = null;
            this._equipSkills = null;
            this.initAllBasicSkills();
            this._runeDic = new Dictionary();
            this._waittingForServerDic = new Dictionary();
            this._exSkillList = [];
            this.getAllCareerSkills();
            this.getAllEquipSkills();
            return;
        }// end function

        public function get isDebugLearn() : Boolean
        {
            return ClientSetting.local.getIsDone(IsDoneType.IsSkillDebug) && Global.isDebugModle;
        }// end function

    }
}
